<template>
    <div class="Preson">
    <h2>中国</h2>
    <h2 ref="title">北京</h2>
    <h2>尚硅谷</h2>
    <button @click="showLog">点击输出h2元素</button>
    </div>
</template>

<script lang="ts" setup>
import { ref,defineExpose } from 'vue';
//  用于存储ref标记的内容
 let title = ref()

 let a = ref(0)
 let b = ref(1)
 let c = ref(2)
 
function showLog() {
    console.log(title.value);
}
// defineExpose导出什么组件实例就有什么
defineExpose({a,b,c})
</script>

<style scoped>
.Preson {
    background-color: #ddd;
    box-shadow: 0 0 10px;
    border-radius: 10px;
    padding: 20px;
}

button { 
    margin: 0 10px;
}
</style>